Dose-response verdinexor
embl2016 <- drugList[["ScreenB"]]
drugSub <- "Verdinexor"
concInter <- embl2016 %>%
dplyr::filter(name %in% c(drugSub),
diagnosis == "T-PLL") %>%
dplyr::select(conc) %>% unique() %>% unlist() %>%
as.vector()
concInter[1:2] <- round(concInter[1:2], 1)
concInter[3:6] <- round(concInter[3:6], 2)
concInter[7:9] <- round(concInter[7:9], 3)
p1 <- embl2016 %>%
dplyr::filter(name %in% c(drugSub),
diagnosis == "T-PLL") %>%
ggplot(aes(x = conc, y = viab, group = sampleID)) +
geom_line(size = 0.25) +
geom_point(size = 3.75, shape = 21, fill = "#64B5F6") +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_y_continuous(limits = c(0, 1.2)) +
scale_x_log10(labels = concInter,
breaks = concInter) +
xlab("Concentration (µM)") + ylab("Viability") +
theme_classic() + ggtitle(paste("Screen B", drugSub, sep = " - ")) +
theme(text = element_text(size = 17.5),
legend.key = element_blank(),
plot.title = element_text(hjust=0.5),
# axis.text.x = element_text(hjust = 1, angle = 45),
axis.text = element_text(size = 17.5),
axis.line = element_line(linewidth = 0.75),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
p1

ggsave(plot = p1, filename = paste0(opt$plot, drugSub, ".png"),
height = 5.25, width = 7)
Dose-response ruxolitinib
drugSub <- "Ruxolitinib"
concInter <- embl2016 %>%
dplyr::filter(name %in% c(drugSub),
diagnosis == "T-PLL") %>%
dplyr::select(conc) %>% unique() %>% unlist() %>%
as.vector()
concInter[1:2] <- round(concInter[1:2], 1)
concInter[3:6] <- round(concInter[3:6], 2)
concInter[7:9] <- round(concInter[7:9], 3)
p1 <- embl2016 %>%
dplyr::filter(name %in% c(drugSub),
diagnosis == "T-PLL") %>%
ggplot(aes(x = conc, y = viab, group = sampleID)) +
geom_line(size = 0.25) +
geom_point(size = 3.75, shape = 21, fill = "#64B5F6") +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_y_continuous(limits = c(0, 1.2)) +
scale_x_log10(labels = concInter,
breaks = concInter) +
xlab("Concentration (µM)") + ylab("Viability") +
theme_classic() + ggtitle(paste("Screen B", drugSub, sep = " - ")) +
theme(text = element_text(size = 17.5),
legend.key = element_blank(),
plot.title = element_text(hjust=0.5),
# axis.text.x = element_text(hjust = 1, angle = 45),
axis.text = element_text(size = 17.5),
axis.line = element_line(linewidth = 0.75),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA))
p1

ggsave(plot = p1, filename = paste0(opt$plot, drugSub, ".png"),
height = 5.25, width = 7)
Dose-response duvelisb
drugSub <- "Duvelisib"
concInter <- embl2016 %>%
dplyr::filter(name %in% c(drugSub),
diagnosis == "T-PLL") %>%
dplyr::select(conc) %>% unique() %>% unlist() %>%
as.vector()
concInter[1:2] <- round(concInter[1:2], 1)
concInter[3:6] <- round(concInter[3:6], 2)
concInter[7:9] <- round(concInter[7:9], 3)
p1 <- embl2016 %>%
dplyr::filter(name %in% c(drugSub),
diagnosis == "T-PLL") %>%
ggplot(aes(x = conc, y = viab, group = sampleID)) +
geom_line(size = 0.25) +
geom_point(size = 3.75, shape = 21, fill = "#64B5F6") +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_y_continuous(limits = c(0, 1.2)) +
scale_x_log10(labels = concInter,
breaks = concInter) +
xlab("Concentration (µM)") + ylab("Viability") +
theme_classic() + ggtitle(paste("Screen B", drugSub, sep = " - ")) +
theme(text = element_text(size = 17.5),
legend.key = element_blank(),
plot.title = element_text(hjust=0.5),
# axis.text.x = element_text(hjust = 1, angle = 45),
axis.text = element_text(size = 17.5),
axis.line = element_line(linewidth = 0.75),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA))
p1

ggsave(plot = p1, filename = paste0(opt$plot, drugSub, ".png"),
height = 5.25, width = 7)
Show reproducibility
diagList <- c("T-PLL")
screenNames <- c("ScreenB", "ScreenC", "ScreenD", "ScreenA", "ScreenE")
pList <- lapply(diagList, function(x) {
pList <- lapply(screenNames, function(y) {
screenData <- drugList[[y]]
screenData <- screenData %>% #filter(diagnosis == x) %>%
group_by(diagnosis, patientID, name) %>%
summarise(viab.auc = mean(normVal, na.rm = TRUE)) %>%
ungroup()
screenNamesOther <- screenNames[which(screenNames != y)]
pList <- lapply(screenNamesOther, function(z) {
screenDataOther <- drugList[[z]]
screenDataOther <- screenDataOther %>% #filter(diagnosis == x) %>%
group_by(diagnosis, patientID, name) %>%
summarise(viab.auc.other = mean(normVal, na.rm = TRUE)) %>%
ungroup()
## Intersect the patients
patOver <- intersect(screenData$patientID, screenDataOther$patientID) %>% unique()
message("Found ", length(patOver), " overlapping patients")
## Intersect the drugs
drugOver <- intersect(screenData$name, screenDataOther$name) %>% unique()
message("Found ", length(drugOver), " overlapping drugs")
## Plot overlap
p <- screenData %>%
filter(patientID %in% patOver, name %in% drugOver) %>%
left_join(screenDataOther, by = c("name", "patientID", "diagnosis")) %>%
ggplot(aes(x = viab.auc, y = viab.auc.other, fill = diagnosis)) +
geom_point(size = 2, shape = 21) +
geom_smooth(method = "lm", colour = "black", fill = "grey80") +
xlab(paste0(gsub(x = y, pattern = "Screen", replacement = "Screen "))) +
ylab(paste0(gsub(x = z, pattern = "Screen", replacement = "Screen "))) +
xlim(0, 1.6) + ylim(0, 1.6) +
#ggtitle(paste0("Drug-Drug corr. ", y, " vs ", z)) +
lgd +
theme(legend.position = "none",
panel.border = element_rect(linewidth = 1, fill = "transparent")) +
scale_fill_manual(values = c("MCL" = "#F44336", "T-PLL" = "#64B5F6", "CLL" = "#FFD45F"))
ggsave(plot = p, filename = paste0(opt$plot, "/screen_corr/", x, "_", y, "_", z, ".png"),
height = 7, width = 7.5, units = "cm")
p
})
#grid.arrange(grobs = pList, ncol = 1)
names(pList) <- screenNamesOther
pList
})
names(pList) <- screenNames
pList
})
names(pList) <- diagList
pList
## $`T-PLL`
## $`T-PLL`$ScreenB
## $`T-PLL`$ScreenB$ScreenC

##
## $`T-PLL`$ScreenB$ScreenD

##
## $`T-PLL`$ScreenB$ScreenA

##
## $`T-PLL`$ScreenB$ScreenE

##
##
## $`T-PLL`$ScreenC
## $`T-PLL`$ScreenC$ScreenB

##
## $`T-PLL`$ScreenC$ScreenD

##
## $`T-PLL`$ScreenC$ScreenA

##
## $`T-PLL`$ScreenC$ScreenE

##
##
## $`T-PLL`$ScreenD
## $`T-PLL`$ScreenD$ScreenB

##
## $`T-PLL`$ScreenD$ScreenC

##
## $`T-PLL`$ScreenD$ScreenA

##
## $`T-PLL`$ScreenD$ScreenE

##
##
## $`T-PLL`$ScreenA
## $`T-PLL`$ScreenA$ScreenB

##
## $`T-PLL`$ScreenA$ScreenC

##
## $`T-PLL`$ScreenA$ScreenD

##
## $`T-PLL`$ScreenA$ScreenE

##
##
## $`T-PLL`$ScreenE
## $`T-PLL`$ScreenE$ScreenB

##
## $`T-PLL`$ScreenE$ScreenC

##
## $`T-PLL`$ScreenE$ScreenD

##
## $`T-PLL`$ScreenE$ScreenA

screenNames
## [1] "ScreenB" "ScreenC" "ScreenD" "ScreenA" "ScreenE"
## Give R2 and p.adj
cor.df.all <- lapply(diagList, function(x) {
lapply(screenNames, function(y) {
screenData <- drugList[[y]]
screenData <- screenData %>% #filter(diagnosis == x) %>%
group_by(diagnosis, patientID, name) %>%
summarise(viab.auc = mean(normVal, na.rm = TRUE)) %>%
ungroup()
screenNamesOther <- screenNames[which(screenNames != y)]
lapply(screenNames, function(z) {
screenDataOther <- drugList[[z]]
screenDataOther <- screenDataOther %>% #filter(diagnosis == x) %>%
group_by(diagnosis, patientID, name) %>%
summarise(viab.auc.other = mean(normVal, na.rm = TRUE)) %>%
ungroup()
## Intersect the patients
patOver <- intersect(screenData$patientID, screenDataOther$patientID) %>% unique()
message("Found ", length(patOver), " overlapping patients")
## Intersect the drugs
drugOver <- intersect(screenData$name, screenDataOther$name) %>% unique()
message("Found ", length(drugOver), " overlapping drugs")
## Plot overlap
cor.df <- screenData %>%
filter(patientID %in% patOver, name %in% drugOver) %>%
left_join(screenDataOther, by = c("name", "patientID", "diagnosis")) %>%
#group_by(name) %>%
nest() %>%
mutate(m = map(data, ~cor.test(~viab.auc+viab.auc.other,.))) %>%
mutate(res = map(m, broom::tidy)) %>%
unnest(res) %>% ungroup() %>%
select(estimate, p.value ) %>%
arrange(p.value)
cor.df$screen1 <- y
cor.df$screen2 <- z
cor.df
}) %>% bind_rows()
}) %>% bind_rows()
}) %>% bind_rows() %>% mutate(p.adj = p.adjust(p.value, method = "BH"))
kable(cor.df.all %>% arrange(p.adj))
| 1.0000000 |
0 |
ScreenB |
ScreenB |
0 |
| 0.7144431 |
0 |
ScreenB |
ScreenC |
0 |
| 0.6434237 |
0 |
ScreenB |
ScreenD |
0 |
| 0.7144431 |
0 |
ScreenC |
ScreenB |
0 |
| 1.0000000 |
0 |
ScreenC |
ScreenC |
0 |
| 0.7536054 |
0 |
ScreenC |
ScreenD |
0 |
| 0.6434237 |
0 |
ScreenD |
ScreenB |
0 |
| 0.7536054 |
0 |
ScreenD |
ScreenC |
0 |
| 1.0000000 |
0 |
ScreenD |
ScreenD |
0 |
| 1.0000000 |
0 |
ScreenA |
ScreenA |
0 |
| 1.0000000 |
0 |
ScreenE |
ScreenE |
0 |
| 0.5903928 |
0 |
ScreenC |
ScreenA |
0 |
| 0.5903928 |
0 |
ScreenA |
ScreenC |
0 |
| 0.6714243 |
0 |
ScreenB |
ScreenA |
0 |
| 0.6714243 |
0 |
ScreenA |
ScreenB |
0 |
| 0.8022378 |
0 |
ScreenB |
ScreenE |
0 |
| 0.8022378 |
0 |
ScreenE |
ScreenB |
0 |
| 0.8022696 |
0 |
ScreenD |
ScreenE |
0 |
| 0.8022696 |
0 |
ScreenE |
ScreenD |
0 |
| 0.6179082 |
0 |
ScreenD |
ScreenA |
0 |
| 0.6179082 |
0 |
ScreenA |
ScreenD |
0 |
| 0.8086957 |
0 |
ScreenC |
ScreenE |
0 |
| 0.8086957 |
0 |
ScreenE |
ScreenC |
0 |
| 0.6758175 |
0 |
ScreenA |
ScreenE |
0 |
| 0.6758175 |
0 |
ScreenE |
ScreenA |
0 |
#View(cor.df.all)
max(cor.df.all$p.adj)
## [1] 1.133701e-11
range(cor.df.all[cor.df.all$estimate < 0.99, ]$estimate)
## [1] 0.5903928 0.8086957
## Also per drug
cor.df <- lapply(diagList, function(x) {
lapply(screenNames, function(y) {
screenData <- drugList[[y]]
screenData <- screenData %>% #filter(diagnosis == x) %>%
group_by(diagnosis, patientID, name) %>%
summarise(viab.auc = mean(normVal, na.rm = TRUE)) %>%
ungroup()
screenNamesOther <- screenNames[which(screenNames != y)]
lapply(screenNamesOther, function(z) {
screenDataOther <- drugList[[z]]
screenDataOther <- screenDataOther %>% #filter(diagnosis == x) %>%
group_by(diagnosis, patientID, name) %>%
summarise(viab.auc.other = mean(normVal, na.rm = TRUE)) %>%
ungroup()
## Intersect the patients
patOver <- intersect(screenData$patientID, screenDataOther$patientID) %>% unique()
message("Found ", length(patOver), " overlapping patients")
## Intersect the drugs
drugOver <- intersect(screenData$name, screenDataOther$name) %>% unique()
message("Found ", length(drugOver), " overlapping drugs")
## Plot overlap
cor.df <- screenData %>%
filter(patientID %in% patOver, name %in% drugOver) %>%
left_join(screenDataOther, by = c("name", "patientID", "diagnosis")) %>%
group_by(name) %>%
nest() %>%
mutate(m = map(data, ~cor.test(~viab.auc+viab.auc.other,.))) %>%
mutate(res = map(m, broom::tidy)) %>%
unnest(res) %>% ungroup() %>%
select(name, estimate, p.value ) %>%
arrange(p.value)
cor.df$screen1 <- y
cor.df$screen2 <- z
cor.df
}) %>% bind_rows()
}) %>% bind_rows()
}) %>% bind_rows() %>% mutate(p.adj = p.adjust(p.value, method = "BH"))
cor.df %>% filter(name %in% c("Birinapant", "Selinexor"))
## # A tibble: 8 × 6
## name estimate p.value screen1 screen2 p.adj
## <chr> <dbl> <dbl> <chr> <chr> <dbl>
## 1 Selinexor 0.338 0.000174 ScreenB ScreenD 0.000671
## 2 Birinapant 0.755 0.000120 ScreenB ScreenE 0.000514
## 3 Selinexor 0.306 0.309 ScreenB ScreenE 0.399
## 4 Selinexor 0.338 0.000174 ScreenD ScreenB 0.000671
## 5 Selinexor 0.912 0.0000355 ScreenD ScreenE 0.000177
## 6 Birinapant 0.755 0.000120 ScreenE ScreenB 0.000514
## 7 Selinexor 0.306 0.309 ScreenE ScreenB 0.399
## 8 Selinexor 0.912 0.0000355 ScreenE ScreenD 0.000177